package week02

// 69. x 的平方根
// https://leetcode-cn.com/problems/sqrtx/

func mySqrt(x int) int {
	var left, right = 0, x
	for left < right {
		var mid = (right - left + 1) >> 1 + left
		if mid * mid <= x {
			left = mid
		} else {
			right = mid - 1
		}
	}
	return left
}
